home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / PC Card Manager / CIncludes / PCI.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-25  |  5.6 KB  |  177 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        PCI.h
  3.  
  4.      Contains:    PCI Bus Interfaces.
  5.  
  6.      Version:    PowerSurge 1.0.2
  7.  
  8.      DRI:        Matthew Nelson
  9.  
  10.      Copyright:    © 1984-1996 by Apple Computer, Inc.
  11.                  All rights reserved.
  12.  
  13.      Warning:    *** APPLE INTERNAL USE ONLY ***
  14.                  This file may contain unreleased API's
  15.  
  16.      BuildInfo:    Built by:            SuperMario Build Daemon
  17.                  With Interfacer:    2.0d11   (PowerPC native)
  18.                  From:                PCI.i
  19.                      Revision:        19
  20.                      Dated:            3/5/96
  21.                      Last change by:    MRN
  22.                      Last comment:    Changed the bracketing of the EndianSwap routines from
  23.  
  24.      Bugs:        Report bugs to Radar component “System Interfaces”, “Latest”
  25.                  List the version information (from above) in the Problem Description.
  26.  
  27. */
  28. #ifndef __PCI__
  29. #define __PCI__
  30.  
  31. #ifndef __TYPES__
  32. #include <Types.h>
  33. #endif
  34. #ifndef __NAMEREGISTRY__
  35. #include <NameRegistry.h>
  36. #endif
  37.  
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41.  
  42. #if PRAGMA_IMPORT_SUPPORTED
  43. #pragma import on
  44. #endif
  45.  
  46. #if PRAGMA_ALIGN_SUPPORTED
  47. #pragma options align=mac68k
  48. #endif
  49.  
  50. #if FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE
  51. /* Types and structures for accessing the PCI Assigned-Address property.*/
  52. #define kPCIAssignedAddressProperty "assigned-addresses"
  53.  
  54. enum {
  55.     kPCIRelocatableSpace        = 0x80,
  56.     kPCIPrefetchableSpace        = 0x40,
  57.     kPCIAliasedSpace            = 0x20,
  58.     kPCIAddressTypeCodeMask        = 0x03,
  59.     kPCIConfigSpace                = 0,
  60.     kPCIIOSpace                    = 1,
  61.     kPCI32BitMemorySpace        = 2,
  62.     kPCI64BitMemorySpace        = 3
  63. };
  64.  
  65. typedef UInt8 PCIAddressSpaceFlags;
  66.  
  67. enum {
  68.     kPCIDeviceNumberMask        = 0x1F,
  69.     kPCIFunctionNumberMask        = 0x07
  70. };
  71.  
  72. typedef UInt8 PCIDeviceFunction;
  73. typedef UInt8 PCIBusNumber;
  74. typedef UInt8 PCIRegisterNumber;
  75. struct PCIAssignedAddress {
  76.     PCIAddressSpaceFlags             addressSpaceFlags;
  77.     PCIBusNumber                     busNumber;
  78.     PCIDeviceFunction                 deviceFunctionNumber;
  79.     PCIRegisterNumber                 registerNumber;
  80.     UnsignedWide                     address;
  81.     UnsignedWide                     size;
  82. };
  83. typedef struct PCIAssignedAddress PCIAssignedAddress;
  84.  
  85. typedef PCIAssignedAddress *PCIAssignedAddressPtr;
  86. #define GetPCIIsRelocatable( AssignedAddressPtr )        ((AssignedAddressPtr)->addressSpaceFlags & kPCIRelocatableSpace)
  87. #define GetPCIIsPrefetchable( AssignedAddressPtr )        ((AssignedAddressPtr)->addressSpaceFlags & kPCIPrefetchableSpace)
  88. #define GetPCIIsAliased( AssignedAddressPtr )            ((AssignedAddressPtr)->addressSpaceFlags & kPCIAliasedSpace)
  89. #define GetPCIAddressSpaceType( AssignedAddressPtr )    ((AssignedAddressPtr)->addressSpaceFlags & kPCIAddressTypeCodeMask)
  90. #define GetPCIBusNumber( AssignedAddressPtr )            ((AssignedAddressPtr)->busNumber)
  91. #define GetPCIDeviceNumber( AssignedAddressPtr )        (((AssignedAddressPtr)->deviceFunctionNumber >> 3) & kPCIDeviceNumberMask)
  92. #define GetPCIFunctionNumber( AssignedAddressPtr )        ((AssignedAddressPtr)->deviceFunctionNumber & kPCIFunctionNumberMask)
  93. #define GetPCIRegisterNumber( AssignedAddressPtr )        ((AssignedAddressPtr)->registerNumber)
  94.  
  95. #if !GENERATINGCFM
  96. #pragma parameter __D0 EndianSwap16Bit(__D0)
  97. #endif
  98. extern pascal UInt16 EndianSwap16Bit(UInt16 data16)
  99.  ONEWORDINLINE(0xE158);
  100.  
  101.  
  102. #if !GENERATINGCFM
  103. #pragma parameter __D0 EndianSwap32Bit(__D0)
  104. #endif
  105. extern pascal UInt32 EndianSwap32Bit(UInt32 data32)
  106.  THREEWORDINLINE(0xE158, 0x4840, 0xE158);
  107.  
  108. #endif
  109. #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
  110. extern pascal OSErr ExpMgrConfigReadByte(RegEntryIDPtr node, LogicalAddress configAddr, UInt8 *valuePtr)
  111.  THREEWORDINLINE(0x303C, 0x0620, 0xAAF3);
  112.  
  113. extern pascal OSErr ExpMgrConfigReadWord(RegEntryIDPtr node, LogicalAddress configAddr, UInt16 *valuePtr)
  114.  THREEWORDINLINE(0x303C, 0x0621, 0xAAF3);
  115.  
  116. extern pascal OSErr ExpMgrConfigReadLong(RegEntryIDPtr node, LogicalAddress configAddr, UInt32 *valuePtr)
  117.  THREEWORDINLINE(0x303C, 0x0622, 0xAAF3);
  118.  
  119. extern pascal OSErr ExpMgrConfigWriteByte(RegEntryIDPtr node, LogicalAddress configAddr, UInt8 value)
  120.  THREEWORDINLINE(0x303C, 0x0523, 0xAAF3);
  121.  
  122. extern pascal OSErr ExpMgrConfigWriteWord(RegEntryIDPtr node, LogicalAddress configAddr, UInt16 value)
  123.  THREEWORDINLINE(0x303C, 0x0524, 0xAAF3);
  124.  
  125. extern pascal OSErr ExpMgrConfigWriteLong(RegEntryIDPtr node, LogicalAddress configAddr, UInt32 value)
  126.  THREEWORDINLINE(0x303C, 0x0625, 0xAAF3);
  127.  
  128. extern pascal OSErr ExpMgrIOReadByte(RegEntryIDPtr node, LogicalAddress ioAddr, UInt8 *valuePtr)
  129.  THREEWORDINLINE(0x303C, 0x0626, 0xAAF3);
  130.  
  131. extern pascal OSErr ExpMgrIOReadWord(RegEntryIDPtr node, LogicalAddress ioAddr, UInt16 *valuePtr)
  132.  THREEWORDINLINE(0x303C, 0x0627, 0xAAF3);
  133.  
  134. extern pascal OSErr ExpMgrIOReadLong(RegEntryIDPtr node, LogicalAddress ioAddr, UInt32 *valuePtr)
  135.  THREEWORDINLINE(0x303C, 0x0628, 0xAAF3);
  136.  
  137. extern pascal OSErr ExpMgrIOWriteByte(RegEntryIDPtr node, LogicalAddress ioAddr, UInt8 value)
  138.  THREEWORDINLINE(0x303C, 0x0529, 0xAAF3);
  139.  
  140. extern pascal OSErr ExpMgrIOWriteWord(RegEntryIDPtr node, LogicalAddress ioAddr, UInt16 value)
  141.  THREEWORDINLINE(0x303C, 0x052A, 0xAAF3);
  142.  
  143. extern pascal OSErr ExpMgrIOWriteLong(RegEntryIDPtr node, LogicalAddress ioAddr, UInt32 value)
  144.  THREEWORDINLINE(0x303C, 0x062B, 0xAAF3);
  145.  
  146. extern pascal OSErr ExpMgrInterruptAcknowledgeReadByte(RegEntryIDPtr entry, UInt8 *valuePtr)
  147.  THREEWORDINLINE(0x303C, 0x0411, 0xAAF3);
  148.  
  149. extern pascal OSErr ExpMgrInterruptAcknowledgeReadWord(RegEntryIDPtr entry, UInt16 *valuePtr)
  150.  THREEWORDINLINE(0x303C, 0x0412, 0xAAF3);
  151.  
  152. extern pascal OSErr ExpMgrInterruptAcknowledgeReadLong(RegEntryIDPtr entry, UInt32 *valuePtr)
  153.  THREEWORDINLINE(0x303C, 0x0413, 0xAAF3);
  154.  
  155. extern pascal OSErr ExpMgrSpecialCycleWriteLong(RegEntryIDPtr entry, UInt32 value)
  156.  THREEWORDINLINE(0x303C, 0x0419, 0xAAF3);
  157.  
  158. extern pascal OSErr ExpMgrSpecialCycleBroadcastLong(UInt32 value)
  159.  THREEWORDINLINE(0x303C, 0x021A, 0xAAF3);
  160.  
  161. #endif
  162.  
  163. #if PRAGMA_ALIGN_SUPPORTED
  164. #pragma options align=reset
  165. #endif
  166.  
  167. #if PRAGMA_IMPORT_SUPPORTED
  168. #pragma import off
  169. #endif
  170.  
  171. #ifdef __cplusplus
  172. }
  173. #endif
  174.  
  175. #endif /* __PCI__ */
  176.  
  177.